<?
	class Account 
	{
		var $account = '';
	
		function __construct($battle_tag) 
		{
			$url = 'http://us.battle.net/api/d3/profile/' . $battle_tag . '/';
		
			$account = json_decode(file_get_contents($url));
			
			$this->account = $account;
		}	
		
		function __get($name)
		{
			return $this->account->$name;
		}
		
		function get_hero($name)
		{
			foreach($this->account->heroes as $hero) 
			{
				if($hero->name == $name)
				{
					return $hero;
				}
			}
		}
	}
	
	if($_GET['battle_tag'])
	{
		header('Content-type: application/json');
		$account = new Account($_GET['battle_tag']);
		echo json_encode($account->account);
	}
?>